package org.mydzms.com.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.dzms.entity.FoodRevDeta;
import org.dzms.services.foodReviewService;

/**
 * Servlet implementation class FoodRevDetaServlet
 */
public class FoodRevDetaServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String frid = request.getParameter("frid");
		System.out.println("0");
		request.setCharacterEncoding("UTF-8");
		String fetaste = request.getParameter("fetaset");
		String feenvironment = request.getParameter("feenvironment");
		String feservice = request.getParameter("feservice");
		String felike = request.getParameter("felike");
		String fereview = request.getParameter("fereview");
		String feperpay = request.getParameter("feperpay");
		String fefeatures = request.getParameter("fefeatures");
//		System.out.println(feenvironment);
//		System.out.println(feservice);
//		System.out.println(fefeatures);
//		System.out.println(fereview);
//		System.out.println(feperpay);
//		System.out.println(fetaste);
//		System.out.println(feperpay);
		FoodRevDeta few = new FoodRevDeta();
		if (fetaste!=null) {
			few.setFetaste(Integer.parseInt(fetaste));
		}
		if (feenvironment!=null) {
			
			few.setFeenvironment(Integer.parseInt(feenvironment));
		}
		if (feservice!=null) {
			
			few.setFeservice(Integer.parseInt(feservice));
		}
		if (felike!=null) {
			few.setFelike(felike);
			
		}
if (fereview!=null) {
			
	few.setFereview(fereview);
		}
if (feperpay!=null) {
	few.setFeperpay(Integer.parseInt(feperpay));
	
}
if (fefeatures!=null) {
	
	few.setFefeatures(fefeatures);
}
		few.setFeid(Integer.parseInt(frid));
		foodReviewService frs = new foodReviewService();
		System.out.println(frs);
		frs.saveFes(few);
	//	request.getRequestDispatcher("foodDetails.jsp").forward(request, response);
		response.sendRedirect("fooddetails?fdid="+frid);
	}

}
